<template>
  <div class="gh-tabItem2" @click="handleClick">
    <img class="gh-tabItem2-bg" :src="bg" />
    <div
      class="gh-tabItem2-label"
      :style="{ color: color }"
    >
      {{ config.label }}
    </div>
    <img class="gh-tabItem2-line" :src="line" />
    <div class="gh-tabItem2-content">
      <div
        class="gh-tabItem2-contet-item"
        v-for="(item, index) of config.detail"
        :key="index"
      >
        <div
          class="gh-tabItem2-val"
          :style="{ color: color }"
        >
          <div
            class="gh-tabItem2-val-num"
            :style="{ color: color }"
          >
            {{ datas[item.value] }}
          </div>
          {{ item.unit }}
        </div>
        <div
          class="gh-tabItem2-name"
          :style="{ color: color }"
        >
          {{ item.name }}
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    bg: {
      type: [Object, String]
    },
    color: {
      type: String
    },
    line: {
      type: [Object, String]
    },
    config: {
      type: Object
    },
    datas: {
      type: Object
    }
  },
  methods: {
    handleClick() {
      this.$emit('change')
    }
  }
}
</script>
<style lang="scss">
.gh-tabItem2 {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
  box-sizing: border-box;
  padding: 10px 0 10px 0;
  cursor: pointer;
  &-bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
  }
  &-label {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 14px;
    line-height: 14px;
    font-weight: 500;
    color: #000000;
    z-index: 1;
    box-sizing: border-box;
    padding: 10px 20px 10px 25px;
  }
  &-line {
    width: 100%;
    height: 1px;
    z-index: 1;
  }
  &-content {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    height: calc(100% - 35px);
    box-sizing: border-box;
    padding: 0 20px;
    &-item {
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: flex-start;
    }
  }
  &-val {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-size: 12px;
    line-height: 12px;
    font-weight: 500;
    color: #000000;
    margin-bottom: 5px;
    &-num {
      font-size: 14px;
      line-height: 14px;
      font-family: DIN;
      font-weight: bold;
      color: #000000;
      margin: 0 5px 0px 0;
    }
  }
  &-name {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 12px;
    line-height: 12px;
    font-weight: 400;
    color: #4c565c;
  }
}
</style>
